package com.sq.partner.manager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sq.partner.manager.dao.ICoreDeptDao;
import com.sq.partner.manager.dao.IGatewayRoleDeptDao;
import com.sq.partner.manager.mybatis.model.CoreDept;
import com.sq.partner.manager.mybatis.model.DeptDto;
import com.sq.partner.manager.mybatis.model.GatewayRoleDept;
import com.sq.partner.manager.mybatis.model.GatewayUser;
import com.sq.partner.manager.service.IGatewayRoleDeptService;
import com.sq.partner.manager.util.Page;
@Service
public class GatewayRoleDeptServiceImpl implements IGatewayRoleDeptService {

	@Resource
	private IGatewayRoleDeptDao roledeptDao;
	@Resource
	private ICoreDeptDao deptDao;
	
	@Override
	public List<DeptDto> queryDeptDto(Long userid) throws Exception {
		return roledeptDao.queryDeptDto(userid);
	}
	@Override
	public boolean addDeptsToOneRole(GatewayRoleDept roleDept) throws Exception {
		return roledeptDao.addDeptsToOneRole(roleDept);
	}
	@Override
	public List<DeptDto> queryDeptDtobyRoleId(Long roleId) throws Exception {
		return roledeptDao.queryDeptDtoByRoleId(roleId);
	}
	
	
	@Override
	public boolean delDeptsToOneRole(Long roleId) throws Exception {
		return roledeptDao.delDeptsToOneRole(roleId);
	}
	@Override
	public Page<CoreDept> queryDeptOfOneUser(Page<CoreDept> page,GatewayUser user) throws Exception {
		return deptDao.queryBranchDeptOfOneUser(page,user);
	}
	@Override
	public boolean updateRoleDeptInfo(GatewayRoleDept roleDept) throws Exception {
		return roledeptDao.updateRoleDeptInfo(roleDept);
	}

}
